package com.itheima.controller;


import com.itheima.pojo.JobOption;
import com.itheima.pojo.Result;
import com.itheima.pojo.StudentOption;
import com.itheima.service.ReportService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/report")
public class ReportController {

    private static final Logger log = LoggerFactory.getLogger(ReportController.class);
    @Autowired
    private ReportService reportService;

    /**
     * 统计各个职位的员工人数
     */
    @GetMapping("/empJobData")
    public Result getEmpJobData(){
        JobOption jobOption= reportService.getEmpJobData();
        log.info("jobOption:{}",jobOption);
        return Result.success(jobOption);
    }

    /**
     *统计员工性别信息
     */
    @GetMapping("/empGenderData")
    public Result getEmpGenderData(){
        List<Map> genderList= reportService.getEmpGenderData();
        log.info("genderList:{}",genderList);
        return Result.success(genderList);
    }
    /**
     * 统计学员的学历信息
     */
    @GetMapping("/studentDegreeData")
    public Result getStudentDegreeData(){
        List<Map> studentDegreeList=reportService.getStudentDegreeData();
        log.info("studentDegreeList:{}",studentDegreeList);
        return Result.success(studentDegreeList);
    }
    /**
     * 统计每一个班级的人数
     */
    @GetMapping("/studentCountData")
    public Result getStudentCountData(){
        StudentOption studentOption=reportService.getStudentCountData();
        return Result.success(studentOption);
    }
}
